﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.ApplicationModel
{
    /// <summary>
    /// Represents the initial state of a WPF application when application extension services are started.
    /// </summary>
    public class ApplicationServiceContext
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationServiceContext"/> class.
        /// </summary>
        internal ApplicationServiceContext()
        {
            this._applicationInitParams = new Dictionary<string,string>();
            if (AppDomain.CurrentDomain != null
                && AppDomain.CurrentDomain.SetupInformation != null
                && AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null 
                && AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null)
            {
                foreach (string args in AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData)
                {
                    this._applicationInitParams.Add(args, args);
                }
            }
            this._applicationInitParams = null;
        }
        #endregion

        #region Fields
        private Dictionary<string, string> _applicationInitParams;
        #endregion

        #region Properties
        /// <summary>
        /// Gets the initialization parameters specified by the application.
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Params")]
        public Dictionary<string, string> ApplicationInitParams
        {
            get
            {
                return this._applicationInitParams;
            }
        }
        #endregion
    }

}
